<template>
    <div>
        <div class="crumbs">
            <div class="contentbox">
                <div class="contentsize">租金管理-对账查看</div>
                <div>
                    <el-button @click="cacelsubmitForm('ruleForm')">返回</el-button>

                </div>
            </div>
        </div>
        <div class="container">
            <el-table :data="tableData" style="width: 100%" :header-cell-style="tableHeaderColor" :row-style="tablerowColor"
                :row-class-name="tableRowClassName" :cell-style="tablecellColor" 
                border :max-height="maxHeight">
                <!-- <el-table-column type="selection" width="55" :selectable="selectable"></el-table-column> -->
                <el-table-column prop="htbh" label="合同编号" align="center" width="160"> </el-table-column>
                <el-table-column prop="dabh" label="档案编号" align="center" width="240" :show-overflow-tooltip="true">
                </el-table-column>
                <el-table-column prop="fwdz" label="房屋地址" align="center" width="280" :show-overflow-tooltip="true">
                </el-table-column>
                <el-table-column prop="czr" label="承租单位" align="center" width="280"> </el-table-column>
                <el-table-column prop="skrq" label="交款日期" align="center" width="100">
                    <template slot-scope="scope">
                        {{ scope.row.jkrq ? scope.row.jkrq.split(' ')[0] : '' }}
                    </template>
                </el-table-column>
                <!-- <el-table-column prop="dzzt" label="对账状态" align="center">
                    <template slot-scope="scope">
                        {{ scope.row.dzzt == '0' ? '未报账' : scope.row.dzzt == '1' ? '退回' :
                            scope.row.dzzt == '2' ? '通过' : scope.row.dzzt == '3' ? '单位待审核' : scope.row.dzzt == '4' ? '经租待审核':scope.row.dzzt == '5' ? '财务待审核':'' }}
                    </template>
                </el-table-column> -->
                <el-table-column prop="jfk" label="交返款" align="center">
                    <template slot-scope="scope">
                        {{ scope.row.jfk == '1' ? '交款' : scope.row.jfk == '2' ? '返款' : '' }}
                    </template>
                </el-table-column>
                <el-table-column prop="ysqje" label="已收金额" align="center" width="100"> </el-table-column>
                <el-table-column prop="ysje" label="预收金额" align="center" width="100"> </el-table-column>
                <el-table-column prop="yzyje" label="预转已金额" align="center" width="100"> </el-table-column>
                <el-table-column prop="jqtje" label="缴其他金额" align="center" width="100"> </el-table-column>
                <el-table-column prop="sqje" label="税前金额" align="center" width="100"> </el-table-column>
                <el-table-column prop="she" label="税额" align="center" width="100"> </el-table-column>
                <el-table-column prop="shje" label="税后金额" align="center" width="100"> </el-table-column>
                <el-table-column prop="zjlb" label="收租方式" align="center"> </el-table-column>
                <el-table-column prop="zph" label="支票号" align="center"> </el-table-column>
                <el-table-column prop="jyjje" label="缴（退）押金金额" align="center" width="140"> </el-table-column>
                <el-table-column prop="tkje" label="退款金额" align="center" width="100"> </el-table-column>
                <el-table-column prop="zsje" label="增收金额" align="center" width="100"> </el-table-column>
                <el-table-column prop="bz" label="备注" align="center" :show-overflow-tooltip="true"> </el-table-column>
                <el-table-column label="操作" width="80" align="center" fixed="right">
                    <template slot-scope="scope">
                        <!-- target="_blank" -->
                        <router-link :to="{ name: 'dzdetail', params: { id: scope.row.id } }">
                            <el-button type="text" size="small">查看</el-button>
                        </router-link>
                    </template>
                </el-table-column>
            </el-table>
            <!-- <div class="pagination" style="float: right">
                <el-pagination background layout="total,sizes,prev, pager, next,jumper" :total="total"
                    :current-page.sync="current" :page-sizes="[10, 20, 30, 40, 50, 100]" :page-size="pageSize"
                    @current-change="handleCurrentChange" @size-change="handleSizeChange">
                </el-pagination>
            </div> -->
        </div>
    </div>
</template>

<script>
import { hbdzjflist, projectdelete } from '@/api/index';
import valueList from '@/components/common/valueList.vue'
export default {
    name: 'hbdzjflist',
    data() {
        return {
            maxHeight:null,
            sjztlist: valueList.sjztlist,//数据状态
            total: 0,
            current: 1,
            pageSize: 10,
            form: {
                cb: '',//产别 ,
                cqdw: '',//产权单位 ,
                create_name: '',//创建人 ,
                create_name_id: '',//创建人id ,
                create_time: '',//创建时间 ,
                current: 1,//第几页 ,
                czr: '',//承租人 ,
                dabh: '',//档案编号 ,
                dqje: '',//当欠金额 ,
                dqsj: '',//合同到期时间 ,
                fwdz: '',//地址 ,
                id: '',//id ,
                jzmj: '',//建筑面积 ,
                pageSize: 10,//每页数量 ,
                qs: '',//区属 ,
                signid: '',//signid ,
                status_code: '1',//1正常 2删除 ,
                type: this.$store.getters.type,//分类 1:房屋 2：楼栋 ,
                update_name: '',//修改人 ,
                update_name_id: '',//修改人id ,
                update_time: '',//修改时间 ,
                ysje: '',//预收金额 ,
                yzj: '',//月租金
            },
            tableData: [],
            multipleSelection: [],//预转已选中列表
        };
    },
    components: {},
    computed: {
        // 判断变色
        getcolorred(htzt) {
            console.log(htzt);
            return (htzt) => {
                if (htzt == "正常") {
                    return { color: "#19BE6B", fontWeight: 700 };
                } else if (htzt == '已经到期') {
                    return { color: "#D9001B", fontWeight: 700 };
                } else if (htzt == '即将到期') {
                    return { color: "#FF9900", fontWeight: 700 };
                } else if (htzt == '未签合同') {
                    return { color: "#409ee1", fontWeight: 700 };
                }
            };
        },
    },
    methods: {
        // 列表样式
       tableHeaderColor({ row, column, rowIndex, columnIndex }) {
            if (rowIndex === 0) {
                return 'background:linear-gradient(to bottom, #008A94,#0ae2f2)!important;color:#ffffff;font-size:14px;'
            }
        },
        tablerowColor({ row, rowIndex }) {
            return 'height: 42px;font-size:14px;color:black'
        },
        tablecellColor(){
            return "font-weight:700;color:#000000;border-color:#c0c0c0";
        },
        tableRowClassName({ row, rowIndex }) {
            if (rowIndex % 2!= 0) {
                return 'success-row' //这是类名
            } else {
                return ''
            }
        },
        // 换页
        handleCurrentChange(val) {
            this.current = val;
            this.form.current = val;
            this.hbdzjflist(this.form);
            console.log(val);
        },
        // 每页条数
        handleSizeChange(val) {
            this.current = 1;
            this.pageSize = val;
            this.form.pageSize = val;
            this.jlbdzlist(this.form);
            console.log(val);
        },
        // 搜索
        onSearch() {
            this.current = 1;
            this.form.current = 1;
            this.hbdzjflist(this.form);
            console.log('搜索');
        },
        // 删除
        deleteClick(e) {
            console.log(e);
            this.$confirm('确定删除此条信息吗？')
                .then(() => {
                    let data = { id: e.id };
                    projectdelete(data).then((res) => {
                        if (res.code == 200) {
                            this.hbdzjflist(this.form);
                            this.$message.success('删除成功');
                        }
                    });
                })
                .catch(() => {
                    this.$message.success('删除取消');
                });
        },
        // 项目列表
        hbdzjflist(data) {
            hbdzjflist(data).then((res) => {
                if (res.code == 200) {
                    this.tableData = res.data;
                    // this.total = res.data.total;
                } else {
                    // this.tableData = [];
                    // this.total = 0;
                }
            });
        },
        // 取消
        cacelsubmitForm() {
            this.$router.go(-1);
        },
    },
    mounted() {
        this.$nextTick(() => {
            // window.innerHeight 浏览器窗口的可见高度，下面的 420 是除了table最大高度的剩余空间。
            this.maxHeight = window.innerHeight - 400
        })
        let data=this.$route.query.id
        this.hbdzjflist(data);
    }
};
</script>

<style scoped>
.container {
    overflow: hidden;
}

.crumbs {
    background-color: #fff;
    padding: 20px 20px;
}

.indexTitle {
    margin-bottom: 20px;
}
.contentbox {
    display: flex;
    justify-content: space-between;
}

.contentsize {
    font-size: 18px;
    font-weight: 700;
    line-height: 32px;
    color: #606266;
}

/* .contentsize {
    font-size: 18px;
    font-weight: 700;
} */

.handle-box {
    overflow: hidden;
}

/* 新增按钮 */
.addcolor {
    margin-bottom: 10px;
}
</style>
